package cn.tude.cn.tedu;


import com.sun.imageio.spi.OutputStreamImageOutputStreamSpi;

import java.io.*;

public class Test_outputstream {
    public static void main(String[] args) throws IOException {
      // method();
       method5();
    }
//    public static void method() {
//        OutputStream out = null;
//        try {
//            out = new FileOutputStream("E:\\java\\456.txt", true);
//            out.write(49);
//            out.write(69);
//            out.write(59);
//            out.write(39);
//            out.write(79);
//        } catch (IOException a) {
//            System.out.println("写出异常");
//        } finally {
//            if (out != null) {
//                try {
//                    out.close();
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }


    public static  void method5(){
         OutputStream out=null;

        try {
             out=new BufferedOutputStream(  new FileOutputStream("E:\\java\\123.txt",true));
            out.write(97);
            out.write(97);
            out.write(97);
            out.write(97);
            out.write(97);



        } catch (FileNotFoundException e) {
            System.out.println("写出异常");
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
